package com.zito.health.service.impl;


import com.zito.health.entity.Role;
import com.zito.health.mapper.RoleMapper;
import com.zito.health.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by gan on 2019/11/4.
 */
@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public Role save(Role object) {
        int res = roleMapper.insertSelective(object);
        return object;
    }

    @Override
    public void delete(Integer id) {
        roleMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(Role object) {
        roleMapper.updateByPrimaryKeySelective(object);
    }

    @Override
    public List<Role> query() {
        return roleMapper.selectAll();
    }

    @Override
    public List<Role> query(Role object) {
        return roleMapper.select(object);
    }

    @Override
    public Role queryOne(Role object) {
        return roleMapper.selectOne(object);
    }

    @Override
    public Role queryById(Integer id) {
        Role object = roleMapper.selectByPrimaryKey(id);
        return object;
    }

    @Override
    public boolean exists(Integer id) {
        return roleMapper.existsWithPrimaryKey(id);
    }

    @Override
    public List<Role> list4Admin(String roleids) {

        return roleMapper.list4Admin(roleids);
    }

}
